<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>

<head>
<title>InitDialogItems</title>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../../styles/styles.css">
<script language="javascript" src='../links.js' type="text/javascript"></script>
</head>
<body>

<h1>InitDialogItems</h1>
<div class=navbar>
<a href="../index.html">main</a> |
<a href="index.html">Addons</a>
</div>


<div class=shortdescr>
The <dfn>InitDialogItems</dfn> function translates an
array of <a href="structures/initdialogitem.html">InitDialogItem</a> structures to
an array of <a href="../dialogapi/structures/fardialogitem.html">FarDialogItem</a> structures.

<p class=note><img src="../../images/caution.gif" alt="Attention!" width="10" height="10"> Attention!</p>
<UL class=note><LI>The <dfn>InitDialogItems</dfn> function is not part of the standard API.</LI></UL>

</div>

<pre class=syntax>
void InitDialogItems(
       const struct InitDialogItem *Init,
       struct FarDialogItem *Item,
       int ItemsNumber
)
{
  int I;
  const struct InitDialogItem *PInit=Init;
  struct FarDialogItem *PItem=Item;
  for (I=0; I &lt; ItemsNumber; I++,PItem++,PInit++)
  {
    PItem-&gt;Type=PInit-&gt;Type;
    PItem-&gt;X1=PInit-&gt;X1;
    PItem-&gt;Y1=PInit-&gt;Y1;
    PItem-&gt;X2=PInit-&gt;X2;
    PItem-&gt;Y2=PInit-&gt;Y2;
    PItem-&gt;Focus=PInit-&gt;Focus;
    PItem-&gt;Reserved=PInit-&gt;Selected;
    PItem-&gt;Flags=PInit-&gt;Flags;
    PItem-&gt;DefaultButton=PInit-&gt;DefaultButton;
    if ((unsigned int)PInit-&gt;Data &lt; 2000)
      strcpy(PItem-&gt;Data,GetMsg((unsigned int)PInit-&gt;Data));
    else
      strcpy(PItem-&gt;Data,PInit-&gt;Data);
  }
}
</pre>
<h3>Parameters</h3>
<div class=descr>

    <div class=dfn>Init</div>
    <div class=dfndescr>Pointer to an array of <a href="structures/initdialogitem.html">InitDialogItem</a> structures.
      Each array item defines one dialog item.</div>
    <div class=dfn>Item</div>
    <div class=dfndescr>Pointer to an array of <a href="../dialogapi/structures/fardialogitem.html">FarDialogItem</a> structures
      to initialize. Each array item will define one dialog item.</div>
    <div class=dfn>ItemsNumber</div>
    <div class=dfndescr>Number of elements in <i>Init</i>.</div>

</div>

<h3>Return value</h3>
<div class=descr>
  <p>None.</p>
</div>

<h3>Remarks</h3>
<div class=descr>
  <p>Use of the InitDialogItems function is reasoned by the following:<br>
  <i>FarDialogItem.Data</i> variable is large, that's why direct
  initalization of an array of <dfn>FarDialogItem</dfn> structures may significantly increase
  memory usage.</p>

  <p>The example bellow shows how to use the InitDialogItems function and the
  <a href="structures/initdialogitem.html">InitDialogItem</a> structure to
  create a dialog.</p>
</div>



<h3>Example</h3>
<div class=descr>
  <p>TempPanel plugin configuration dialog sample:</p>

<pre class=code>int Config()
{
  <a href="structures/initdialogitem.html">struct InitDialogItem</a> InitItems []={
    DI_DOUBLEBOX,3,1,72,8,0,0,0,0,(char *)MConfigTitle,
    DI_CHECKBOX,5,2,0,0,0,0,0,0,(char *)MConfigAddToDisksMenu,
    . . .
    DI_BUTTON,0,7,0,0,0,0,DIF_CENTERGROUP,1,(char *)MOk,
    DI_BUTTON,0,7,0,0,0,0,DIF_CENTERGROUP,0,(char *)MCancel
  };
  <a href="../dialogapi/structures/fardialogitem.html">struct FarDialogItem</a> DialogItems[sizeof(InitItems)/sizeof(InitItems[0])];
  . . .
  InitDialogItems(InitItems,DialogItems,sizeof(InitItems)/sizeof(InitItems[0]));
  . . .
  int ExitCode=Info.Dialog(Info.ModuleNumber,
                  -1,-1,76,10,
                  &quot;TempCfg&quot;,DialogItems,
                  sizeof(DialogItems)/sizeof(DialogItems[0]));
  if (ExitCode != 7)
    return(FALSE);
. . .
}
</pre>
<br>&nbsp;
</div>

<div class=see>See also:</div><div class=seecont>
<a href="../dialogapi/dialog.html">Dialog</a> |
<a href="structures/initdialogitem.html">InitDialogItem</a> |
<a href="../dialogapi/structures/fardialogitem.html">FarDialogItem</a>
</div>
</body>
</html>